package com.lebang.controller.api;

import com.lebang.domain.AppCloseMsg;
import com.lebang.service.AppCloseMsgService;
import com.lebangweb.response.Callback;
import com.lebangweb.response.JsonData;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Author: hwq
 * @Date: 2020/1/13 14:57
 * @Version 1.0
 */
@RestController
@RequestMapping("/app/close")
public class AppCloseApi {

    @Autowired
    private AppCloseMsgService appCloseMsgService;


    @PostMapping("/msg")
    public JsonData msg(HttpServletRequest request) {
        List<AppCloseMsg> list = appCloseMsgService.findAllList();
        int size=RandomUtils.nextInt(0,list.size());
        return Callback.success("success", "查询成功", list.get(size));
    }
}
